package com.game.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.game.service.IRoomService;
import com.game.util.ResultEnum;
import com.game.util.ResultInfo;


@RestController
@RequestMapping("/room")
public class RoomController {
	
	@Autowired
	private IRoomService roomService;
	@RequestMapping("/create")
	public ResultInfo add(String uid){
		return roomService.create(uid);
	}
	@RequestMapping("/join")
	public ResultInfo join(String uid,String roomNo){
		if(!StringUtils.isEmpty(roomNo)&&!StringUtils.isEmpty(uid)){
			return roomService.join(uid,roomNo);
		}else{
			return new ResultInfo(ResultEnum.PARARMERROR);
		}
	}
}
